<style>
    #billboy{
        font-size: 14px;
        width: 80%;
    }
    #userdetail{
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
        font-size: 16px;
    }
    #userdetail input{
        width: 80%;
        height: 20px;
        font-size: 16px;
        padding: 2px;
    }
    #userdetail select{
        width: 50%;
        font-size: 16px;
        padding: 2px;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 15%;
        height: 50px;
    }
    #cf{
        width: 35%;
    }
</style>
<?php
if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("客服记录添加成功！");location.href = "/admini/manageday/servicelog/"; </script>';
}else if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("客服记录添加失败，请重新添加！");</script>';
}
?>
<div id="billboy">
    <div id='userdetail'>
        添加客服记录
        <form action="/admini/manageday/addserlog/" method="post">
            <table width="100%" border="1" cellpadding="0" cellspacing="0">  
                <tr>
                  <td id='bf'>客户名称：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" id="userName" name="userName" value="" /></td>
                  <td id='bf'>仓库号：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="storeNo" id="storeNo"  value=""/></td>
                </tr>
                <tr>
                  <td id='bf'>客户QQ：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="qq" id="qq" value=""/></td>
                  <td id='bf'>客户所在地：</td>
                  <td id='cf' valign="middle" ><input type="hidden" name="state" id="state" value="1"/>
                      <div style="position: relative;" id="state_div">
                        <div class="guyojiatext">&nbsp;&nbsp;<?= $this->formText('cityName',"美国",array('readonly'=>true,'cid'=>1)) ?><a href="javascript:void(0)"></a></div>
                        <div class="guojiaceng" style="display:none;top:33px;">
                            <div class="remen">
                                <h2>热门国家和地区</h2>
                                <ul class="countrylist">
                                    <li><a href="javascript:void(0)" id="c_us" cid="1">美国</a></li>
                                    <li><a href="javascript:void(0)" cid="2">加拿大</a></li>
                                    <li><a href="javascript:void(0)" cid="3">澳大利亚</a></li>
                                    <li><a href="javascript:void(0)" cid="47">日本</a></li>
                                    <li><a href="javascript:void(0)" cid="39">台湾</a></li>
                                    <li><a href="javascript:void(0)" cid="4">新西兰</a></li>
                                    <li><a href="javascript:void(0)" cid="5">英国</a></li>
                                    <li><a href="javascript:void(0)" cid="42">马来西亚</a></li>
                                </ul>
                            </div>
                            <div class="allcountry">
                                <h2>全部国家和地区</h2>
                                <ul class="countryzm">
                                    <? foreach ($this->words as $char) { ?>
                                        <li <?= $char == 'A' ? 'class="zmon"' : '' ?>><a href="javascript:void(0)"><?= $char ?></a></li>
                                    <? } ?>
                                </ul>
                                <div id="countryTab">
                                    <? foreach ($this->words as $char) { ?>
                                        <ul class="countrylist"  <?= $char == 'A' ? '' : 'style="display:none"' ?>>
                                            <?
                                            $citys = Application_Model_city::GetBySortCode($char);
                                            foreach ($citys as $city) {
                                                ?>
                                                <li><a href="javascript:void(0)" cid="<?= $city->Id ?>"><?= $city->Name ?></a></li>
                                        <? } ?>
                                        </ul>
                                   <? } ?>
                                </div>
                            </div>
                        </div>
                      </div>
                  </td>
                </tr>
                <tr>
                  <td id='bf'>客户类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="userType" name="userType">
                        <?php foreach ($this->userTypeAll as $key => $userTypeVal) { ?>
                            <option value="<?php echo $key;?>"><?php echo $userTypeVal;?></option>
                        <?php }?>
                    </select></td>
                  <td id='bf'>接待客服：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="serName" id="serName"  value=""/></td>
                </tr>
                <tr>
                  <td id='bf'>内容类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="firstType" name="firstType">
                        <?php foreach ($this->firstTypeAll as $key => $firstTypeVal) { ?>
                            <option value="<?php echo $key;?>"><?php echo $firstTypeVal;?></option>
                        <?php }?>
                    </select></td>
                  <td id='bf'>功能类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="functionType" name="functionType">
                        <?php foreach ($this->functionTypeAll as $key => $functionTypeVal) { ?>
                            <option value="<?php echo $key;?>"><?php echo $functionTypeVal;?></option>
                        <?php }?>
                    </select></td>
                </tr>
                <tr>
                  <td id='bf'>紧急类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="urgencyType" name="urgencyType">
                        <?php foreach ($this->urgencyTypeAll as $key => $urgencyTypeVal) { ?>
                            <option value="<?php echo $key;?>"><?php echo $urgencyTypeVal;?></option>
                        <?php }?>
                    </select></td>
                  <td id='bf'>后续操作：</td>
                  <td id='cf' valign="middle">&nbsp;
                      <select id="status" name="status">
                          <option value="<?php echo Application_Model_Service::Status_Normal;?>" selected>无</option>
                          <option value="<?php echo Application_Model_Service::Status_WaitDispose;?>">有</option>
                      </select>
                  </td>
                </tr>
                <tr>
                  <td id='bf' style="height:250px;">内容：</td>
                  <td id='cf' colspan="3" valign="middle">&nbsp;&nbsp;<textarea name="content" id="content"  cols="99" rows="12" style="font-size:16px;resize:none;"></textarea></td>
                </tr>
                <tr class="slove_tr" style="display:none;">
                    <td id='bf'>处理人：</td>
                    <td id='cf' valign="middle">&nbsp;&nbsp;<select id="solveName" name="solveName" >
                        <?php foreach ($this->userAll as $userVal) { ?>
                                <option value="<?php echo $userVal->id;?>"><?php echo $userVal->nikename;?></option>
                        <?php }?></select></td>
                    <td id='bf'>预计处理时间：</td>
                    <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="solveDay" id="solveDay"  value=""/>天</td>
                </tr>
                <tr class="slove_tr" style="display:none;">
                    <td id='bf'>处理方案：</td>
                    <td id='cf' valign="middle">&nbsp;&nbsp;<textarea name="comment" id="comment"  cols="50" rows="12" style="font-size:16px;resize:none;"></textarea></td>
                    <td id='bf'>知会人：</td>
                    <td id='cf' valign="middle">&nbsp;&nbsp;<select id="knowUser" name="knowUser[]" size="12" multiple="multiple">
                        <?php foreach ($this->userAll as $userVal) { ?>
                                <option value="<?php echo $userVal->id;?>"><?php echo $userVal->nikename;?></option>
                        <?php }?></select></td>
                </tr>
                <tr>
                    <td id='cf' colspan="4" align="right"><input type="hidden" name="operate" id="operate" value="addser" />
                        <input type="submit" id="submit" name="submit" value="添加记录" style="background-color: #1668A4;width: 80px;height: 36px;color: white;font-size: 16px;border-radius:8px;" />&nbsp;&nbsp;</td>
                </tr>
              </table>
          </form>
    </div>
</div>
<script type="text/javascript">
    $('#submit').click(function(){
        var qq = $('#qq').val();
        var sername = $('#serName').val();
        var content = $('#content').val();
        var status = $("#status").val();
        if(qq == ''){
            alert("客户QQ不能为空！");
            return false;
        }else if(sername == ''){
            alert("客服名称不能为空！");
            return false;
        }else if(content == ''){
            alert("信息内容不能为空！");
            return false;
        }else{
            return true;
        }
    });
    $("#status").change(function(){
        if($(this).val() == 2)
            $(".slove_tr").show(); 
        else
            $(".slove_tr").hide();
    });
    $('#state_div').hover(function(){
    },function(){
        $('.guojiaceng').hide();
    }).click(function(){
        $('.guojiaceng').show();
    });
    $('.countrylist a').bind('click',function(){
        var city =$(this).text();
        var state = $(this).attr("cid");
        $("#state").val(state);
        $("#cityName").val(city);
        $('.guojiaceng').hide();
        return false;
    });
    $('.countryzm a').each(function(index,item){
        $(item).click(function(){
            $('.countryzm li.zmon').removeClass('zmon');
            $(this).parent().addClass('zmon');
            $('#countryTab ul').hide();
            $('#countryTab ul').eq(index).show();
            return false;
        });
    });
</script>